﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace SignalBox.Core.Model.Timetable
{
    public abstract class TrainScheduleAction : INotifyPropertyChanged
    {

        public TrainSchedule Schedule
        {
            get;
            set;
        }

        private string mTime;

        public string Time
        {
            get
            {
                return mTime;
            }
            set
            {
                mTime = value;
                OnPropertyChanged("Time");
            }
        }

        public string Description
        {
            get { return GetDescription(); }
        }

        public abstract string GetDescription();

        public abstract XElement ToXml();

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));

            if (propertyName != "Description")
                OnPropertyChanged("Description");
        }
    }
}
